import pandas as pb
import csv
df=pb.read_excel('date/京东-麻辣王子辣条评论.xlsx')
datevals=df.values
finalDatas = []
for i in range(len(datevals)):
    rowDate=[]
    row=datevals[i]
    comment=row[0]#获取评论
    user=row[1]#获取用户
    inf_of_commd=row[2]#获取s商品信息
    time=row[3]#获取时间
    loc=row[4]#获取地点

    rowDate.append(comment)
    rowDate.append(user)
    rowDate.append(inf_of_commd)
    rowDate.append(time)
    rowDate.append(loc)

    finalDatas.append(rowDate)
colTitles=['评论','用户','商品信息','评论时间','地点']
with open('date/京东-麻辣王子辣条评论.csv','w',encoding='utf-8') as f:

    writer=csv.writer(f)
    writer.writerow(colTitles)
    writer.writerows(finalDatas)
